import requests
import json
from openai import OpenAI


if __name__ =='__main__':
    # client = OpenAI(api_key="sk-ZTbCbxHD6jtiWGhtwTIdLZsEYlfpnKw7EaxCWH3E4owjsiTg", base_url="https://api.moonshot.cn/v1")
    # response = client.chat.completions.create(
    #     model="moonshot-v1-8k",
    #     messages=[{"role": "user", "content": "你好"}]
    # )
    # print(response.choices[0].message.content)
    url = "http://10.16.22.69:3000/api/v1/chat/completions"

    # client.chat.completions.create

    payload = json.dumps({
        "chatId": "1234",
        "messages": [
            {
                "role": "user",
                "content": "新增储备项目的时候，项目类别我们只想要一个，其他的在哪删掉呢，新增其他类别的时候在哪新增"
            }
        ]
    })
    headers = {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer fastgpt-hPKHHFPhJhUs3CaCXMyxIJTr7alYqwqFkwCWIyrpVanjEpTdpXkmXicUJI7dQ7yKB'

    }

    response = requests.request("POST", url, headers=headers, data=payload)

    print(response.text)
